A macro resembles a function in C, executes after the specified parameter is passed in, and inside the macro can contain the data step program and the conditional operation symbol.A macro variable is just a small variable 、、、、 (by the same is a great role)1: Basic syntax for macrosHow do I create a simple macro and use
Tags: style blog http io ar color OS using SP1: Macro definition in program runCall Routines -enable you-transfer information between an executing DATA step and the Macro Proces Sor.You can use the symput routine to create a macro variable, and to assign to, variable any value, is Availa ble in the DATA step.Symput routine to create a
0x00. Word 0xaa55ee11 @ Insert byte: 0x11 0xEE 0x55 0xAA (LSB order)
. Byte
Insert byte to destination file
. Byte, ' A ' @ Inserts the bytes 0x40 0x41. Byte 0x42 @ Inserts the byte 0x42. Byte 0b1000011, 0104 @ Inserts the bytes 0x43 0x44
. Code
Set the number of instruction bits, 16-bit thumb or 32-bit arm
. code 16 @ Set the following assembly as thumb instructions
. else
Use with. if and. endif
. end
End of symbol
-directives can define a piece of code as a whole called a macro directive calls the code multiple times in a program through a macro directive.
{} is optional
$ marking when a macro is expanded labels are replaced with user-defined symbols the first line of the macro definition body should declare the prototype
purge can be used to cancel the macro definition when appropriate to restore the original meaning of the command.Macro definition:Add macro opr1, opr2, result...EndmMacro call:...Add XX, YY, ZZPurge add...After a macro is called, use the purge pseudo operation to cancel the definition so as to restore the original meaning of the add command. The add command used
. An ASM statement can define data objects in the code segment with the MASM directives DB, DW, and DQ. The MASM directives DT, DF, Struc, and, and the operators DUP, this, WIDTH, and MASK are not accepted. Macros. An-ASM statement can use C preprocessor macros even though the inline assembler ' not ' a macro assembler and does not supp ORT MASM
, record, WIDTH, and mask instructions. However, inline assembler can be used to a _EMIT macro directive, it is similar to the DB instruction in MASM, which defines a byte type within the region, although it can define only one byte at a time, but it is still possible to define a string, see the example:
#define randasm __asm _emit 0x4A __asm _emit 0x43 __asm _emit 0x4B … __asm { randasm }
Although the
A macro is a powerful preprocessing command of the assembler. It is similar to other preprocessing commands and starts compilation in the assembler.
Code Previously, the macro was processed. Its syntax rules are as follows:
Name macro [parameter [: Tag] [, parameter [: Tag
Master the basic Arm assembly instructions, to write a simple arm assembler program, but also have to master the basic Arm Assembly pseudo operation (Directive). Now let's look at a simple assembler that calls the subroutine to complete the addition operation.
1. FileName: Test.s2; function: realize two registers add together3 area example,code,readonly; declaring code Snippets Example4 ENTRY; Logo Program
; Operation mnemonic Value field can be a mnemonic for instruction, pseudo-operation, macro-instruction, or pseudo-instruction.
2> ARM Assembler is case sensitive, in assembly language programming, each instruction mnemonic can be all uppercase, or all in lowercase, but not allowed in an instruction large, lowercase mixed.
3> All instructions cannot be written at the beginning of the line, there must be a s
v1--Single-parameter macros#define DRV_DEBUG 1#if DRV_DEBUG #define DRV_PRINT(x) printf(x)#else #define DRV_PRINT(x) #endifThis version of Drv_print (x) can only output a single variable--pure stringvoid foo(){ DRV_PRINT("Driver Initialize Success!");}Change the Drv_debug macro definition when you do not need to print debug information#define DRV_DEBUG 0Of course, you can define it directly.#define DRV_PRINT printfBut if the
irrelevant to the specific processor type, but related to the assembler version.3. Macro commands: these commands are composed of a series of commands or pseudo commands. Several machine commands are displayed during compilation to improve programming efficiency.Pseudoand macro commands are processed by the assembler
Objective
We learned about the use environment of the WIN32 assembly, and in this section we start with the simplest Win32 assembler to understand the basic structure and syntax of the WIN32 assembler.
I. Structure and grammar of the WIN32ASM program
Let's take a look at one of the simplest WIN32 assembler programs:
.386. Model Flat, StdCallOption Casemap:non
example 18.1. The simplest assembly procedure#PURPOSE: Exits and returns a# status code back to the Linux kernel# #INPUT: none# #OUTPUT: Returns a status code. This can is viewed# by typing## Echo $?## after running the program# #VARIABLES: # %eax holds the system cal L number# %EBX holds the return status#. Section. Data. Section. Text. Globl _START_START:MOVL $,%eax# this is the Linux kernel command# number (System call) for exiting# a program movl $4,%ebx# This is the status number
*Map
Map
Defines the first address of a structured memory table. In this case, the location counter of the memory table
{Var}
Set to this address value
{Var}
Is the built-in variable of the assembler.
^
And
Map
Synonymous
.
Pseudocommand format:
Map expr
,
{Base_register}
Where:
Expr
Numeric expression orProgram. When the command does not contain
Base_register
,
Expr
It is the first address of the structured
updated./N display command to be executed during make, but not really execute/P make is to display detailed information macro definition overwrite the macro definition target in the description file (makefile) with the new definition specify to create a file described in the description file (makefile)
For example:
Make clean
Used to clear the temporary files generated during the compilation process, that
I. Advantages and disadvantages of inline compilation
Because using inline assembler in Visual C + + does not require additional compilers and connectors, and can handle things that are not possible in Visual C + +, and can be used in C + + variables, it is convenient. The inline assembly is mainly used in the following situations:
1. Use assembly language to write functions;
2. Code that requires very high speed;
3. Direct access to hardware in t
This article has been updated. Please refer to the new articleBasic Win32 Assembly knowledge compiled by Jack Http://blog.csdn.net/magus_yang/archive/2007/04/05/1552930.aspx
Title: Jack's first Win32 Assembler helloworldOperator: Jack Yang time: link: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>; part 1: schema and source program format definition statement. 386; instruction set. model flat, stdcall; working mode option Casemap: n
(1). Preprocessing (CPP): There is more than one type of preprocessor, and the preprocessor of C/s is one of the lowest end--lexical preprocessor, which is the simple work of text substitution, macro expansion, and deletion of annotations .
The GCC-E option can be preprocessed, with the extension. I;
C + + preprocessing does not do any syntax checking, not only because it does not have syntax checking, but because preprocessing commands d
enter the values of each element of the array, invoke the assembly code to obtain the maximum value of the and the maximum position in the array */ #include Void Main () { extern found (int i,int*j,int *k,int *s); int i,j,k,s[10]; printf ("Enter Values of array:/n"); for (i=0;i scanf ("%d", s[i]); i=10; found (i,j,k,s); printf ("/nthe max_value is:%d/n", j); printf ("The Place is:%d/n", K); }
2, write the following assembler co
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.